#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
	int n, m, i, j, len, cnt, flg, t;
	char num[10];

	scanf("%d %d", &n, &m);

	if (m < n) {
		t = m;
		m = n;
		n = t;
	}

	cnt = 0;
	for (i=n; i<=m; i++) {
		sprintf(num, "%d", i);
		len = strlen(num);
		flg = 1;
		for (j=0; j<len/2; j++) {
			if (num[j] != num[len-1-j]) {
				flg = 0;
				break;
			}
		}
		if (1 == flg) cnt++;
	}

	printf("%d\n", cnt);

	return 0;
}
